UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+6aQeWVensQUOiu2Nc65Y2xrJkYfNzPPOwHA+2JdbNU=' 
WHERE 
  key_id = 'c310c07e2442396d455a78a1adc50abd125b1ad44ce78f1fe13d8d2ab38a8b77' 
  AND (
    token = '+6aQeWVensQUOiu2Nc65Y2xrJkYfNzPPOwHA+2JdbNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019