UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Pa7XNuSQoB89qE6xhfS9XExWDWMGWuZd04MMYYM0Pw='
WHERE
key_id = 'ad241b47031e254791b6994fd042d191159ae5ad7d72c93276347ae7c90bcc57'
AND (
token = '8Pa7XNuSQoB89qE6xhfS9XExWDWMGWuZd04MMYYM0Pw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)