UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vFz2prIqAJdGx9lIG523qliFqVucXzDsmL3rmFULwgk=' 
WHERE 
  key_id = '562e86cb73cd84659fde4aaeab89a6fe3ba420034a36fd2d9f4b84bed58caa47' 
  AND (
    token = 'vFz2prIqAJdGx9lIG523qliFqVucXzDsmL3rmFULwgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027