UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mntDhqfzSrWPeyBGLxfkeFSR2u9iqoH11s/Mz7VbHJU=' 
WHERE 
  key_id = '51574fba297b3b402a347321b6b8184ce62c23528b5026c8f2e67331a3c745cb' 
  AND (
    token = 'mntDhqfzSrWPeyBGLxfkeFSR2u9iqoH11s/Mz7VbHJU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023