UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jl1yIcn1UtHg3IzsFtS8ev1f6hlYwEHDuLWeJPgyLdk='
WHERE
key_id = '8c4250ede123092fc5751a27ddcba12ad2965086c3efaa9dd5c868d92ebc2166'
AND (
token = 'jl1yIcn1UtHg3IzsFtS8ev1f6hlYwEHDuLWeJPgyLdk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)