UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'beauq9Yf8wwJJ01rZ2A7WVdiQAKLX7bFq+eefScsk2k='
WHERE
key_id = '9a9cfebd944c777251c90cdb30ecf043467161a1da53d58075108c0a58fa1301'
AND (
token = 'beauq9Yf8wwJJ01rZ2A7WVdiQAKLX7bFq+eefScsk2k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)