UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XxfZD9ABlg1+NbfeBQUndxQ5JNixzicwEkjXMATET0w='
WHERE
key_id = '237db2b0dc0297c34d9d23cbcf5a8591e99dcea31fa6feb330908dd3d9314489'
AND (
token = 'XxfZD9ABlg1+NbfeBQUndxQ5JNixzicwEkjXMATET0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)