UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b1sjLMgEwrp82NXzRbsOaLPU3GbvfTc4gu9CiS0Ox68='
WHERE
key_id = '01e57226a26f58376db14a6843e168d054d7c2fbbb80c3be05f2d8e534df7051'
AND (
token = 'b1sjLMgEwrp82NXzRbsOaLPU3GbvfTc4gu9CiS0Ox68='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)