UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6cDOp/ZqICaWkOeLIWCa0am0x4l27GiOK6Knds5Xd4Q=' 
WHERE 
  key_id = '39d261e4ff719fd8f8f70051470871bbe86986ee420ae316c0ccb1e18748f734' 
  AND (
    token = '6cDOp/ZqICaWkOeLIWCa0am0x4l27GiOK6Knds5Xd4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025