UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ryC+5fPEso+WBCYJUYirr9ZeK/9wroQ+Sv146qOxk4g=' 
WHERE 
  key_id = '573ae4e393e6060aff942e231fd259f1c454fa917d51d6322b9b5c80d0f64900' 
  AND (
    token = 'ryC+5fPEso+WBCYJUYirr9ZeK/9wroQ+Sv146qOxk4g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038