UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HxIQnt7UUVFeFKY7e8OMmRF99rump0teFB36xnaHxWU=' 
WHERE 
  key_id = 'd49db7c94f4e436bd6f78e2652ed2c96cd3dce47679a72f67dabb1060366f4c7' 
  AND (
    token = 'HxIQnt7UUVFeFKY7e8OMmRF99rump0teFB36xnaHxWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052