UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uTP85I7OkC27mLmNtUcV5B26skxc6SdIXn1Zna+EYDA='
WHERE
key_id = 'dbf1b4a68b917682abe57722f53a46ba0e28469d94eba54a1176b8f2b2eb05bd'
AND (
token = 'uTP85I7OkC27mLmNtUcV5B26skxc6SdIXn1Zna+EYDA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)