UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0MtCAZq6pCnbPWWj4pvvdog5c16i4aAvPgkMDkPR0Pk='
WHERE
key_id = '440f98bd3f778b977efcc820829e0b1c41a4ba153409fb245e718830b42cd562'
AND (
token = '0MtCAZq6pCnbPWWj4pvvdog5c16i4aAvPgkMDkPR0Pk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)