UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4TPkKyEGBUrKWSfwjFiNrEVjP9y4puUoNeVn0cHjUGk='
WHERE
key_id = 'bc0e31613db1319e000b00546822d77a8a2798d1aabff0018ad5014352fca4d8'
AND (
token = '4TPkKyEGBUrKWSfwjFiNrEVjP9y4puUoNeVn0cHjUGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)