UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AcU0xIgD4S11C6tVE5nYf2N9pJshTwZ7OTUnnRXTqu4='
WHERE
key_id = 'b786b5ef8c0ff6ae47f82cf36ea72cd221cfb82f9e750cbd62539c54f1cfd54d'
AND (
token = 'AcU0xIgD4S11C6tVE5nYf2N9pJshTwZ7OTUnnRXTqu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)