UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bzRviQ4fU0g0ScKT0yNQfvrAVnk6nWnneM6usyxWAdo='
WHERE
key_id = 'f3bdde51435dc55f5d18c0a1a843555d7a7df6c4484c43c8b02bd099c5f08778'
AND (
token = 'bzRviQ4fU0g0ScKT0yNQfvrAVnk6nWnneM6usyxWAdo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)