UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ATF49SklG20YMXVox6PiRYriUGvfYd5YN+UPf4Q8p+s='
WHERE
key_id = '386e9a5f165b424805ede5a09285ffa464da3e9ea431068b0b69a177002bdf8a'
AND (
token = 'ATF49SklG20YMXVox6PiRYriUGvfYd5YN+UPf4Q8p+s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)