UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gPydFUtnBE6V+x3ycgDZ6CA68YgmWySZeckC00hZbtM=' 
WHERE 
  key_id = 'f20a8e770e8c47ca1eab33d424f3991d49055565732e9ad646ebb70be892548b' 
  AND (
    token = 'gPydFUtnBE6V+x3ycgDZ6CA68YgmWySZeckC00hZbtM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027