UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bI57AXmb7K83d2dDGE3sb1b8ZQ/Y4eklqPfCADPBqeQ=' 
WHERE 
  key_id = '826680e736c8e4d2859da62e69e74adc206511977993dc544a7e8e66fd791872' 
  AND (
    token = 'bI57AXmb7K83d2dDGE3sb1b8ZQ/Y4eklqPfCADPBqeQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043