UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aeGRysDNgrg+5A0bfXNKe89EQWpaAsP09qbasK3vLPw='
WHERE
key_id = '8899e77c53f20ba8d7d353879e53aa197d570997eb63b842c8b4f4236cc8af10'
AND (
token = 'aeGRysDNgrg+5A0bfXNKe89EQWpaAsP09qbasK3vLPw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)