UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C5aS40bgD5egzo2LzxmUMPJcXRGVvjFb38j5Sf8FoP4='
WHERE
key_id = '21e316fb439df390179663b11215cde5f4ae38e75de7b228d1c12fd9a0bffbd5'
AND (
token = 'C5aS40bgD5egzo2LzxmUMPJcXRGVvjFb38j5Sf8FoP4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)