UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fmcXpMob3JDFEXB1vbFwIVkxml8F+Lq2Xf+OT5lMd7s=' 
WHERE 
  key_id = '4e057aa83635cc1ba8f9273d45aca6d018a7789d8df06e0c8d475e137fa45448' 
  AND (
    token = 'fmcXpMob3JDFEXB1vbFwIVkxml8F+Lq2Xf+OT5lMd7s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021