UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gy3TeY/nHOrKCYGqmg7nVGGKvmQ5PNSlZ8yUj7qqusA='
WHERE
key_id = '9107099f7862839a2b12f2567a7f63f2a558e5d3b0c02c89d6ede484dd2a798c'
AND (
token = 'gy3TeY/nHOrKCYGqmg7nVGGKvmQ5PNSlZ8yUj7qqusA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)