UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6LUNhKfRwLChyZ5ilCEYbP9sorTTihNWc2X3An51ERc='
WHERE
key_id = '0fdb1e8d7d1119d84666c8889ce3fe8aef8621feac3de2385128a0b43ae6d3c8'
AND (
token = '6LUNhKfRwLChyZ5ilCEYbP9sorTTihNWc2X3An51ERc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)