UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cd9AZ2QzJBlWj/f54L6OWdDSt03rz7gzZFmuiNR1eRw='
WHERE
key_id = 'daab3bbfc2690d3e6cc8ab627dd21aee4d361fbd24f43caf42d5def093acdfd0'
AND (
token = 'Cd9AZ2QzJBlWj/f54L6OWdDSt03rz7gzZFmuiNR1eRw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)