UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sQ7VBUU9aVCU/+oIVYy6u6D/0n1YJMHPdvtRHPDyWy8='
WHERE
key_id = 'ee43af56161cc88b34efe1de10a928031b67d4cc40adbd02c17e4ee2ba89d2dc'
AND (
token = 'sQ7VBUU9aVCU/+oIVYy6u6D/0n1YJMHPdvtRHPDyWy8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)