UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5qT4bv2Aiaa/KmIuYAwXOeuzxLYVnDYVogAONuFjRk0='
WHERE
key_id = '4333ce4e4e41b968e5f8902b83be9d1927042b9549165a33b92f846b9d16ff38'
AND (
token = '5qT4bv2Aiaa/KmIuYAwXOeuzxLYVnDYVogAONuFjRk0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)