UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V7wRrVs9iYmIv3+iXbjHDP+PuSiUmTxhi8IPErRpflc=' 
WHERE 
  key_id = '74e3afe103dbc1a65eeb2fe3aa82bde1a1ea17071ac06a775ff7490a9166c778' 
  AND (
    token = 'V7wRrVs9iYmIv3+iXbjHDP+PuSiUmTxhi8IPErRpflc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044