UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RwSQ6Li+a+CRlNOQgw4XvVEYoCgf0FHm4o3n0taqNIw=' 
WHERE 
  key_id = '0172fc13ef868106defab4b94c2f9a75613e05a6f8453177078becc2acb278c6' 
  AND (
    token = 'RwSQ6Li+a+CRlNOQgw4XvVEYoCgf0FHm4o3n0taqNIw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046