UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r7JrbEE7SIiUgR5Npg7Oyc1zChVPuiJrfdaRK4//EZE='
WHERE
key_id = 'a89d548ad7afff0800dcc702d0a3670e96e604689ca8a92da766c6270ca92e84'
AND (
token = 'r7JrbEE7SIiUgR5Npg7Oyc1zChVPuiJrfdaRK4//EZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)