UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pGezkR04Vuy+Wt4Cykb7qiWEL5EWJ8qHUx5/37XToPk='
WHERE
key_id = 'cd7a99e86c93ce505622bce398451be921b5b40294501bd48c5784ac1a6f654a'
AND (
token = 'pGezkR04Vuy+Wt4Cykb7qiWEL5EWJ8qHUx5/37XToPk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)