UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vY8mne8/hpi4AnyhtBrztMjP6Csomgf5F4RXpFh1XIc=' 
WHERE 
  key_id = '20e8f9d490d936e2d891379468f033a2f21c81873ab23149b98638d3cb9ab2dd' 
  AND (
    token = 'vY8mne8/hpi4AnyhtBrztMjP6Csomgf5F4RXpFh1XIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00111