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