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