UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r7pGn3VPVM8nYHWgOwDUBPlmn5fAMl0AkAbaeMI2L2k='
WHERE
key_id = '8b2a451cc799dd1a41668a3753e2f26d60667d599f13f997deaaaa3264a5734a'
AND (
token = 'r7pGn3VPVM8nYHWgOwDUBPlmn5fAMl0AkAbaeMI2L2k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)