UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NNe/WE4Rfnlwas5nQmvEB76xyij6qXi1N/RT7d9Ftto='
WHERE
key_id = '0e0c4fa5f73a270b32329dc418e1faf804f974455c7327a77f77180701b9432d'
AND (
token = 'NNe/WE4Rfnlwas5nQmvEB76xyij6qXi1N/RT7d9Ftto='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)