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