UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u5iFMHGuGf+58W5saci4YuCTOfHyn1BPS156HRAo+C4='
WHERE
key_id = 'bc3e7487e4bbd6c16bbabe77f8b8b0693e9b13bc862ea8d7b23dd4d2b75b1461'
AND (
token = 'u5iFMHGuGf+58W5saci4YuCTOfHyn1BPS156HRAo+C4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)