UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1rHLbT/F4cHO52WSyuWOqaTDo8zlpoIWg8ZyP2DOvn8=' 
WHERE 
  key_id = 'a5c45f9c62472b034d52790cdd31fee47a8409e68a70962c7811519382b9854a' 
  AND (
    token = '1rHLbT/F4cHO52WSyuWOqaTDo8zlpoIWg8ZyP2DOvn8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034