UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b969C1SFpQcmk3HgnVht9LPEw9i/PkQ95ivoOkDJYIQ=' 
WHERE 
  key_id = '9c40c01e4848f7bcff00d5ccfe0bf8ccdb23157da1954c0432864f1005c0de67' 
  AND (
    token = 'b969C1SFpQcmk3HgnVht9LPEw9i/PkQ95ivoOkDJYIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030