UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4zTCE9FxFJBcYdWECUkfdW1ySnawN8fdQi/qF7NPKlw='
WHERE
key_id = 'e6f5f4b4e99fe77cd71ef7ad9fa2f5fe8e434fe127f2df0f04db70f39ea7d856'
AND (
token = '4zTCE9FxFJBcYdWECUkfdW1ySnawN8fdQi/qF7NPKlw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)