UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pGPcZz2HNz3TeFAAVULMzlhQa4va23HCqMso/sjdOEM=' 
WHERE 
  key_id = 'be41f78fe35f8808c7930caa50521b24920df168f779d97a64e68760dcb5275e' 
  AND (
    token = 'pGPcZz2HNz3TeFAAVULMzlhQa4va23HCqMso/sjdOEM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053