UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cA1kdtC+oZdnWmnOR3SfDpmUMFzK1hREGs8peIRZIsc=' 
WHERE 
  key_id = '15fa655b1a4c6aaf8a0ec3ed7b9ca3268ed628ef0afdec881e53aca0cb98296e' 
  AND (
    token = 'cA1kdtC+oZdnWmnOR3SfDpmUMFzK1hREGs8peIRZIsc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037