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