UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ddr/uFTd+TYV0y7ROWUUdNOB8zS/bKCb1VINW0EVjng=' 
WHERE 
  key_id = '386e678076aec7305847b06ce6fac148365d6c144c95c72686b8003292da1c13' 
  AND (
    token = 'ddr/uFTd+TYV0y7ROWUUdNOB8zS/bKCb1VINW0EVjng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030