UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qiAbv0nBXpUKU6iylS1p1rHEfj0N4etMgJ8re9fuveQ=' 
WHERE 
  key_id = '388c79bc4ff9a5ad53b55e59432024e360b639ff71bd7cee331f4003d3b1f5c0' 
  AND (
    token = 'qiAbv0nBXpUKU6iylS1p1rHEfj0N4etMgJ8re9fuveQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00095