UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AmIRcgAydCy0JEjDWpaxAxqa7Dn1szlwhok6gh38e1Y='
WHERE
key_id = '579990d2c48e0d8c52fb37ed1ecb3a4d077eeeda45f1f8d2455f0c8c5142da62'
AND (
token = 'AmIRcgAydCy0JEjDWpaxAxqa7Dn1szlwhok6gh38e1Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)