UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jgPiGRpYpCyxg7regiGOFnbjaGgf7sYpekzl0PTT1gE='
WHERE
key_id = '7c1bf022acced1666c6a9041927e5fb4eb58a2e87e9a1f89eafba06e6e1d86ef'
AND (
token = 'jgPiGRpYpCyxg7regiGOFnbjaGgf7sYpekzl0PTT1gE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)