UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pM7QbjC7B3sFOgjjfZVlA044+1d66+cs2i43PN+JkBY=' 
WHERE 
  key_id = '10f3b19c54f6c242c8ae889d7dbad8f7a4b69909125180c8c8b4bc2fbe3c02e5' 
  AND (
    token = 'pM7QbjC7B3sFOgjjfZVlA044+1d66+cs2i43PN+JkBY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033