UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WgWGcE0TJBLU2YH6f7QmXEVRXfnCDe+uDqKBxfu37is=' 
WHERE 
  key_id = 'fb6f1ff84e4705bb0eb9a99284d87eb5935bbc484151637f9632e29a61be8e9b' 
  AND (
    token = 'WgWGcE0TJBLU2YH6f7QmXEVRXfnCDe+uDqKBxfu37is=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017